Ext.define('DCApp.view.catalog.Detail', {
    extend: 'DCApp.view.Detail',
    alias: 'widget.catalogdetail',
    
    requires: ['DCApp.ux.ComboTree'],
    bind: {
        title: '期刊 - 【{theObj.catalogId}】'
    },
    
    componentCls: 'catalog-detail',
    bodyPadding: 0,
    
    controller: 'detail',
   
    afterRender: function(ct, position) {
    	var imgpanel = this.down('imgpanel');
    	if(imgpanel){
	    	var tb = imgpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	var attachpanel = this.down('attachpanel');
    	if (attachpanel) {
	    	var tb = attachpanel.down('toolbar[dock=top]');
	    	tb.insert(1,[{
	    		text:'插入'
	    	}]);
    	}
    	this.callParent();
    },
    items: [{
    	listeners: {
		  render: function(p){
			p = p.getEl();
			var me= this.up();
			me.h0=p.getHeight();
		    p.on('scroll', function(e, t){
		    	me.onscroll(t.scrollTop,t.clientHeight);
		    }, p);
		  }
		},
    	title: 'Panel 0',
        flex: 2,
        frame: false,
        xtype: 'container',
        layout: 'anchor',
        style: {
            overflow: 'auto'
        },
        items: [
                {        		
        			title : '期刊信息',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					reference : 'form',
					bodyPadding : 10,
					fieldDefaults : {
						labelAlign : 'right',
						labelWidth : 100,
						padding : 3
					},
					defaults : {
						anchor : '100%'
					},
					xtype: 'form',
					items: [					       
						{
						    xtype: 'container',
						    layout: 'hbox',
						    combineErrors: true,
						    defaultType: 'textfield',
						    items:[
						        {
						        	flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '论文期刊描述',
						            allowBlank: false,
						            bind: '{theObj.catalogName}',
						            publishes: ['value']
						        },
						        {
						    		flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '论文期刊名称',
						            allowBlank: false,
						            bind: '{theObj.catalogAuther}',
						            publishes: ['value']
						        }	                        
							]
						},
						{
						    xtype: 'container',
						    layout: 'hbox',
						    combineErrors: true,
						    defaultType: 'textfield',
						    items:[
						        {
						        	flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '来源',
						            allowBlank: false,
						            bind: '{theObj.catalogSource}',
						            publishes: ['value']
						        },
						        {
						    		flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '出版社',
						            allowBlank: false,
						            bind: '{theObj.publishHouse}',
						            publishes: ['value']
						        }	                        
							]
						},
						{
						    xtype: 'container',
						    layout: 'hbox',
						    combineErrors: true,
						    defaultType: 'textfield',
						    items:[
						        {
						        	flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '日期',
						            allowBlank: false,
						            bind: '{theObj.publishDate}',
						            publishes: ['value']
						        },
						        {
						    		flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '字数',
						            allowBlank: false,
						            bind: '{theObj.wordNum}',
						            publishes: ['value']
						        }	                        
							]
						},
						{
						    xtype: 'container',
						    layout: 'hbox',
						    combineErrors: true,
						    defaultType: 'textfield',
						    items:[
						        {
						        	flex: 1,
						            xtype: 'textfield',
						            fieldLabel: '页数',
						            allowBlank: false,
						            bind: '{theObj.pageNum}',
						            publishes: ['value']
						        },
						        {
						    		flex: 1,
						            xtype: 'displayfield',
						            fieldLabel: ''
						        }	                        
							]
						}
					]
        		},
				{
					title : '相关影像',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
							bind: '{theObj.images}',
	                    	xtype:'imgpanel',
	                    	btns:['关联','删除']
						}
					]
				},
				{
					title : '相关论文',
					margin : '0 0 10 0',
					cls : 'nav_pos',
					layout : 'fit',
					items : [
						{
						 bind: '{theObj.theses}',
						 xtype : 'thesislist',
						 plugins: null,
						 tbar: ['->',{
						        text: '关联',
						        handler: 'onRel'
						    },{
						        text: '删除',
						        handler: 'onDel'
						    }]
						}
					]							
				}               
        ]
    }]
});
